import { HttpModule, HttpService } from '@nestjs/axios';
import { CommonModule } from './../common/common.module';
import config from 'src/config/config';
import { AdminauthMiddleware } from 'src/middleware/adminauth.middleware';
import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';

import { MainController } from './main/main.controller';
import { LoginController } from './login/login.controller';
import { ManagerController } from './manager/manager.controller';
import { RoleController } from './role/role.controller';
import { AccessController } from './access/access.controller';
import { FocusController } from './focus/focus.controller';
import { UploadController } from './upload/upload.controller';
import { GoodsTypeController } from './goods-type/goods-type.controller';
import { GoodsTypeAttributeController } from './goods-type-attribute/goods-type-attribute.controller';
import { GoodsCateController } from './goods-cate/goods-cate.controller';
import { GoodsController } from './goods/goods.controller';
import { GoodsColorController } from './goods-color/goods-color.controller';
import { GoodsAttrController } from './goods-attr/goods-attr.controller';
import { GoodsImageController } from './goods-image/goods-image.controller';
import { NavController } from './nav/nav.controller';
import { ShopSettingController } from './shop-setting/shop-setting.controller';
import { BombingController } from './bombing/bombing.controller';

@Module({
    imports: [CommonModule, HttpModule.register(config.httpModuleOptions)],
    controllers: [
        MainController,
        LoginController,
        ManagerController,
        RoleController,
        AccessController,
        FocusController,
        UploadController,
        GoodsTypeController,
        GoodsTypeAttributeController,
        GoodsCateController,
        GoodsController,
        GoodsColorController,
        GoodsAttrController,
        GoodsImageController,
        NavController,
        ShopSettingController,
        BombingController,
    ],
})
export class AdminModule implements NestModule {
    configure(consumer: MiddlewareConsumer) {
        consumer.apply(AdminauthMiddleware).forRoutes(config.adminRoot);
    }
}
